﻿@model CustomerProductReviewsModel
@using Grand.Web.Models.Customer;
@inject IPageHeadBuilder pagebuilder
@{
    Layout = "_ColumnsTwo";

    //title
    pagebuilder.AddTitleParts(T("PageTitle.Account").Text);
}
@section left
{
    @await Component.InvokeAsync("CustomerNavigation", new { selectedTabId = CustomerNavigationEnum.Reviews })
}
<div class="page account-page product-reviews-page pl-lg-3 pt-lg-0 pt-3">
    <h1 class="h2 generalTitle">@T("Account.Reviews")</h1>
    @if (Model.Reviews.Any())
    {
        <div class="product-review-list">
            @foreach (var review in Model.Reviews)
            {
                int ratingStars = review.Rating;
                <b-card header-tag="header" footer-tag="footer" class="product-review-item mb-3">
                    <template v-slot:header>
                        <div class="review-info d-inline-flex w-100">
                            <b-icon icon="calendar2-check" variant="info" class="mx-2"></b-icon>
                            <small class="date text-muted">
                                <span>@T("Reviews.Date"):</span>
                                <span>@review.CreatedOn.ToString("g")</span>
                            </small>
                        </div>
                    </template>
                    <div class="review-title mb-3">
                        <div class="user d-inline-flex align-items-center w-100">
                            <b-link href="@Url.RouteUrl("Product", new { SeName = review.ProductSeName })"><h6 class="mb-0">@review.ProductName</h6></b-link>
                        </div>
                        <b-form-rating id='rating-inline2' class='p-0' variant='warning' no-border size='sm' show-value precision='2' readonly inline value='@(ratingStars)'></b-form-rating>
                    </div>
                    <div class="review-content">
                        <div class="review-text">
                            @review.ReviewText
                        </div>
                    </div>
                    <template v-slot:footer>
                        @if (!string.IsNullOrEmpty(review.ReplyText))
                        {
                            <div class="reply-content">
                                <blockquote class="administration-response">
                                    <h5 class="administration-response-header">@T("Reviews.AdministrationResponse")</h5>
                                    <i>@review.ReplyText</i>
                                    <p class="h6 mb-0 mt-2">@review.Signature</p>
                                </blockquote>
                            </div>
                        }
                    </template>
                </b-card>
            }
        </div>
    }
    else
    {
        <div class="no-data pt-3">
            @T("Account.Reviews.NoExists")
        </div>
    }
</div>

